package com.apobates.jforum2.troll.notices.entity;

import java.util.Optional;
import java.util.stream.Stream;

/**
 * 信件的类型
 *
 * @author xiaofanku
 * @since 20200510
 */
public enum ForumLetterTypeEnum {
    ALL(0, "所有"),
    NOTICE(1, "通知"),
    LETTER(2, "私信"),
    CLAIM(3, "公告");
    
    private final int symbol;
    private final String title;
    
    private ForumLetterTypeEnum(int symbol, String title) {
        this.symbol = symbol;
        this.title = title;
    }

    public int getSymbol() {
        return symbol;
    }

    public String getTitle() {
        return title;
    }

    /**
     * ForumLetterTypeEnum.symbol返回实例
     * @param symbol
     * @return
     */
    public static Optional<ForumLetterTypeEnum> getInstance(final int symbol){
        return Stream.of(ForumLetterTypeEnum.values()).filter(fae->fae.getSymbol() == symbol).findFirst();
    }
}